package com.sokal.easycare.modules.sys.entity;

import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sokal.easycare.modules.sys.entity.MainUser;

import com.sokal.easycare.common.persistence.DataEntity;

/**
 * 用户银行账号Entity
 * 
 * @author yangmin
 * @version 2017-05-25
 */
public class UserBankAccount extends DataEntity<UserBankAccount> {

	private static final long serialVersionUID = 1L;
	private String bankId; // 账户类型
	private String bankNumber; // 账号
	private String bankName; // 银行名称
	private String bankBranch; // 银行支行信息
	private String name; // 姓名
	private String curBlance; // cur_blance
	private String status; // 账号状态
	private Date stateDate; // 状态改变日期
	private String remark; // 备注
	private MainUser user; // user_id
	private Date beginStateDate; // 开始 状态改变日期
	private Date endStateDate; // 结束 状态改变日期

	public UserBankAccount() {
		super();
	}

	public UserBankAccount(String id) {
		super(id);
	}

	@Length(min = 0, max = 64, message = "账户类型长度必须介于 0 和 64 之间")
	public String getBankId() {
		return bankId;
	}

	public void setBankId(String bankId) {
		this.bankId = bankId;
	}

	@Length(min = 0, max = 30, message = "账号长度必须介于 0 和 30 之间")
	public String getBankNumber() {
		return bankNumber;
	}

	public void setBankNumber(String bankNumber) {
		this.bankNumber = bankNumber;
	}

	public String getBankName() {
		return bankName;
	}

	public void setBankName(String bankName) {
		this.bankName = bankName;
	}

	public String getBankBranch() {
		return bankBranch;
	}

	public void setBankBranch(String bankBranch) {
		this.bankBranch = bankBranch;
	}

	@Length(min = 0, max = 30, message = "姓名长度必须介于 0 和 30 之间")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCurBlance() {
		return curBlance;
	}

	public void setCurBlance(String curBlance) {
		this.curBlance = curBlance;
	}

	@Length(min = 1, max = 3, message = "账号状态长度必须介于 1 和 3 之间")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getStateDate() {
		return stateDate;
	}

	public void setStateDate(Date stateDate) {
		this.stateDate = stateDate;
	}

	@Length(min = 0, max = 256, message = "备注长度必须介于 0 和 256 之间")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public MainUser getUser() {
		return user;
	}

	public void setUser(MainUser user) {
		this.user = user;
	}

	public Date getBeginStateDate() {
		return beginStateDate;
	}

	public void setBeginStateDate(Date beginStateDate) {
		this.beginStateDate = beginStateDate;
	}

	public Date getEndStateDate() {
		return endStateDate;
	}

	public void setEndStateDate(Date endStateDate) {
		this.endStateDate = endStateDate;
	}

	/**
	 * 用户类型
	 */
	public static enum AccountState {

		VALID("10A", "有效"), FREEZE("10B", "冻结"), LOGOUT("10X", "注销");

		private String value = null;
		private String desc = null;

		private AccountState(String v, String desc) {
			this.value = v;
			this.desc = desc;
		}

		public String value() {
			return this.value;
		}

		public String desc() {
			return this.desc;
		}
	}

}